package com.rpframework.utils

import org.apache.commons.lang3.StringUtils

/**
 * String类扩展
 * Created by 刘兴 on 2016/11/27.
 */
/**
 * 是否空字符和对象NULL
 */
val String?.blank: Boolean
    get() {
        return StringUtils.isBlank(this)
    }

/**
 * 字符串插值 角标[index] 后面插入 值[value]
 * eg: list  0 => /list
 */
fun String.interpolation(index: Int, value: String): String =
        this.substring(0, index) + value + this.substring(index, this.length)


fun String.parseCharset(now: String): String =
        String(this.toByteArray(charset(now)))

fun String.parseCharsetParam(): String =
        this.parseCharset("IOS-8859-1")
